package com.ultimatech.webappdemo.base;

import org.springframework.context.annotation.*;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;

/**
 * Created by zhangleping on 16/10/17.
 */
@Configuration
@ImportResource("classpath*:conf/*-beans.xml")
@PropertySource("classpath:conf/dsConf.properties")
public class Config {



        @Bean
        public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
            return new PropertySourcesPlaceholderConfigurer();
        }

//    public PropertiesFactoryBean getPropertiesFactory(){
//        PropertiesFactoryBean propertiesFactory=new PropertiesFactoryBean();
//        Resource[] resources=new Resource[]{new ClassPathResource("conf.properties")};
//        propertiesFactory.setLocations(resources);
//        return propertiesFactory;
//    }
//
////    public PreferencesPlaceholderConfigurer propertyConfigurer(){
////        PreferencesPlaceholderConfigurer conf=new PreferencesPlaceholderConfigurer();
////        Resource[] resources=new Resource[]{new ClassPathResource("conf.properties")};
////        conf.setLocations(resources);
////        return conf;
////    }
//
//    @Bean(name = "sessionFactory")
//    public LocalSessionFactoryBean initSessionFactory() throws IOException {
//        LocalSessionFactoryBean sessionFactory=new LocalSessionFactoryBean();
//        sessionFactory.setHibernateProperties(this.getPropertiesFactory().getObject());
//        sessionFactory.setAnnotatedPackages("com.ultimatech.webappdemo.base.model");
//        return sessionFactory;
//    }
}
